import React, { useCallback } from "react"
import { Field_FormSave, Field_name_id } from "@/components/utils/field.list"
import { FormProps } from "@/components/modal/form.modal"
import adminLogsService from "@/services/admin.logs.service"
import { FormRender } from "@whzhuke/antd"
import { useFetch } from "@whzhuke/usehook"
import useForm from "antd/es/form/hooks/useForm"
interface Props {
  logId?: any
}
export const GetLogDetail: React.FC<Props & FormProps> = props => {
  const { logId, onDone } = props
  const [form] = useForm<any>()
  const [{ data: details }] = useFetch(adminLogsService.item, [{ id: logId }])
  return (
    <FormRender
      form={form}
      initialValues={details}
      layout="horizontal"
      labelCol={{ span: 8 }}
      wrapperCol={{ span: 16 }}
      style={{ width: 600 }}
      fieldList={[
        { fieldType: "input", formItemConfig: { name: "requestUri", label: "请求URI" }, config: { disabled: true } },
        { fieldType: "textArea", formItemConfig: { name: "params", label: "请求参数" }, config: { autoSize: true } },
        { fieldType: "textArea", formItemConfig: { name: "result", label: "操作结果" }, config: { autoSize: true } }
      ]}
      autoComplete="off"
    />
  )
}
